# Lucasiewicz logic, defined in mvl-toolkit by Koen Lefever 2009-2010, GPL v.3 licensed

from Logic import *

class L3(Logic):
    """Lucasiewicz logic"""
    def __init__(self, truth_values_list = [0, 0.5, 1], designated_values_list = [1]):
        if not len(truth_values_list) == 3:
            raise ValueError('L3 is a ternary logic, please provide three truth values.')
        if not len(designated_values_list) == 1:
            raise ValueError('Please provide exactly one designated value for L3.')
        Logic.__init__(self, truth_values_list, designated_values_list)
        
    def AND(self, P, Q):
        return self.operator(113, P, Q)

    def OR(self, P, Q):
        return self.operator(4049, P, Q)

    def IF_THEN(self, P, Q):
        return self.operator(19418, P, Q)

    def NOT(self, P):
        return self.operator(19305, P, P)

